package soccerBet.project.dao;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import soccerBet.project.objects.*;
import soccerBet.project.utils.*;

public class ConfiguracaoDAO {




	
	
	public Configuracao getConfiguracao() {

		Session session = HibernateUtil.getSessionFactory().openSession();
		
		Configuracao conf = (Configuracao)  session.
		createQuery("select c from Configuracao as c where c.idConfig = ?").setInteger(0, 1).uniqueResult();

		session.close();
		
		return conf;


	}

	public void updateDataConfiguracao() {
	Session session = HibernateUtil.getSessionFactory().openSession();
		
		session.beginTransaction();
		
		session.
		createQuery("update Configuracao set dataActualizacao = ? ").setTimestamp(0, new Date()).executeUpdate();
		
		session.getTransaction().commit();
		
		
		session.close();
		
	}


}